
const {
  mrjAsyncBaseReq, //  基本请求
  BaseRequestModel, // 基本请求对象
} = require('./mrhhttp')

const api_load_catagory_list = "/core/category/list"
const api_action_add = "/core/merchant/user/add"// 
const api_action_delete = "/core/merchant/user/delete"
const api_action_edit = "/core/merchant/user/edit"
const api_load_detail = "/core/merchant/user/role/detail"
const api_load_list  = "/core/merchant/user/list"
const api_action_add_invite_code = "/core/merchant/invite/add" // 生成邀请码
const api_load_invite_info_detail = "/auth/invite/code";//获取邀请码详细信息
const api_action_join_invite = "/auth/invite/code/confirm";// 加入商户

const MerchantUserHttp = {
  actionAddInviteCode:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_action_add_invite_code}`,
      param: param
    });
    return res.data
  },
  loadInviteCodeDetail:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_load_invite_info_detail}`,
      param: param
    });
    return res.data
  },
  actionJoinMerchantByInviteCode:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_action_join_invite}`,
      param: param
    });
    return res.data
  },
  actionDelete:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_action_delete}`,
      param: param
    });
    return res.data
  },
  actionAdd:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_action_add}`,
      param: param
    });
    return res.data
  },
  actionEdit:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_action_edit}`,
      param: param
    });
    return res.data
  },
  loadList:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_load_list}`,
      param: param
    });
    return res.data
  },
  loadCatagoryList:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_load_catagory_list}`,
      param: param
    });
    return res.data
  },
  
  loadDetail:async param=>{
    const res = await mrjAsyncBaseReq({
      ...BaseRequestModel,
      url: `${BaseRequestModel.baseUrl}${api_load_detail}`,
      param: param
    });
    return res.data
  },
}
module.exports = MerchantUserHttp